package org.example.main;

import org.example.grafica.TemplateMenuAttivita;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;

public class SchermataAvvio extends Activity implements OnClickListener {
	
	public static String BOTTONE_CLICCATO = "button_clicked";
	View secondaRiga;
	View quintaRiga;
	View primaRiga;
	View terzaRiga;
	View quartaRiga;
	
	String bottonecliccato;
	public void onCreate(Bundle savedInstanceState){
		super.onCreate(savedInstanceState);
		setContentView(R.layout.avvio);

		//View bottoneCCN = this.findViewById(R.id.BottoneCCN);
		//bottoneCCN.setOnClickListener(this);
		primaRiga = this.findViewById(R.id.primaRiga);
		primaRiga.setOnClickListener(this);
		quartaRiga = this.findViewById(R.id.quartaRiga);
		quartaRiga.setOnClickListener(this);
		terzaRiga = this.findViewById(R.id.terzaRiga);
		terzaRiga.setOnClickListener(this);
		secondaRiga = this.findViewById(R.id.secondaRiga);
		secondaRiga.setOnClickListener(this);
		quintaRiga = this.findViewById(R.id.quintaRiga);
		quintaRiga.setOnClickListener(this);
		View exit = this.findViewById(R.id.Exit);
		exit.setOnClickListener(this);
	}

	public void onClick(View v) {
    	Intent i = new Intent();
    	switch (v.getId())
    		{
    		case R.id.primaRiga:
    			primaRiga.setBackgroundResource(R.color.arancione);
    			i.setClass(this, Parcheggio.class);
    			startActivity(i);
    			break;
    		case R.id.quartaRiga:
    			quartaRiga.setBackgroundResource(R.color.arancione);
    			i.setClass(this, Bus.class);
    			startActivity(i);
    			break;
    		case R.id.terzaRiga:
    			terzaRiga.setBackgroundResource(R.color.arancione);
    			i.setClass(this, Meteo.class);
    			startActivity(i);
    			break;
    		case R.id.secondaRiga:
    			secondaRiga.setBackgroundResource(R.color.arancione);
    			i.setClass(this, Traffico.class);
    			startActivity(i);
    			break;
    		case R.id.quintaRiga:
    			quintaRiga.setBackgroundResource(R.color.arancione);
    			i.setClass(this, CentroCommerciale.class);
    			startActivity(i);
    			break;
    		case R.id.Exit:
    			finish();
    			//System.exit(1);
    			
    			break;
    		} 
	}
	
	public void onResume(){
		super.onResume();
		System.out.println("*******on resume*****");
		primaRiga.setBackgroundResource(R.color.nero2trasp);
		secondaRiga.setBackgroundResource(R.color.nero2trasp);
		terzaRiga.setBackgroundResource(R.color.grigiotrasp);
		quartaRiga.setBackgroundResource(R.color.grigiotrasp);
		quintaRiga.setBackgroundResource(R.color.grigiotrasp);
		
		
	}
	
}
